import * as actionType from './actionType'
import axios from 'axios'
//import store from '../../../store'
//不使用redux-thunk 操作异步发送请求
/* export const getHomeList = (dispatch)=>{
  axios.get('/api/home.json').then((res)=>{
    const action = {
      type: "GTE_HOME_LIST",
      value: res.data.ceshi
     }
	 //console.log(res.data.ceshi)
     store.dispatch(action)
  })
} */
//使用 redux-thunk 操作异步请求
export const getHomeList = () => {
  return (dispatch) => {
    axios.get('/api/home.json').then((res)=>{
      const action = {
        type: "GET_HOME_LIST",
        value: res.data.ceshi
	  }
      dispatch(action)
	})
  }
}

export const changeValue = (value)=>({
  type: actionType.CHANGE_VALUE,
  value
})